Integrand size = 16, antiderivative size = 55 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=\frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2}-\frac {\csc (x)}{a} \]
[Out]
Time = 0.08 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3182, 3855, 3153, 212} \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2}+\frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\csc (x)}{a} \]
[In]
[Out]
Rule 212
Rule 3153
Rule 3182
Rule 3855
Rubi steps \begin{align*} \text {integral}& = -\frac {\csc (x)}{a}-\frac {b \int \csc (x) \, dx}{a^2}+\frac {\left (a^2+b^2\right ) \int \frac {1}{a \cos (x)+b \sin (x)} \, dx}{a^2} \\ & = \frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\csc (x)}{a}-\frac {\left (a^2+b^2\right ) \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (x)-a \sin (x)\right )}{a^2} \\ & = \frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\sqrt {a^2+b^2} \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{a^2}-\frac {\csc (x)}{a} \\ \end{align*}
Time = 0.34 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.22 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=\frac {2 \sqrt {a^2+b^2} \text {arctanh}\left (\frac {-b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )-a \csc (x)+b \left (\log \left (\cos \left (\frac {x}{2}\right )\right )-\log \left (\sin \left (\frac {x}{2}\right )\right )\right )}{a^2} \]
[In]
[Out]
Time = 0.44 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.47
method | result | size |
default | \(-\frac {\tan \left (\frac {x}{2}\right )}{2 a}-\frac {\left (-4 a^{2}-4 b^{2}\right ) \operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{2 a^{2} \sqrt {a^{2}+b^{2}}}-\frac {1}{2 a \tan \left (\frac {x}{2}\right )}-\frac {b \ln \left (\tan \left (\frac {x}{2}\right )\right )}{a^{2}}\) | \(81\) |
risch | \(-\frac {2 i {\mathrm e}^{i x}}{a \left ({\mathrm e}^{2 i x}-1\right )}-\frac {b \ln \left ({\mathrm e}^{i x}-1\right )}{a^{2}}+\frac {b \ln \left ({\mathrm e}^{i x}+1\right )}{a^{2}}-\frac {\sqrt {a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i x}-\frac {i a -b}{\sqrt {a^{2}+b^{2}}}\right )}{a^{2}}+\frac {\sqrt {a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i x}+\frac {i a -b}{\sqrt {a^{2}+b^{2}}}\right )}{a^{2}}\) | \(127\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 133 vs. \(2 (51) = 102\).
Time = 0.28 (sec) , antiderivative size = 133, normalized size of antiderivative = 2.42 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=\frac {b \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \sin \left (x\right ) - b \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \sin \left (x\right ) + \sqrt {a^{2} + b^{2}} \log \left (-\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (x\right ) - a \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}}\right ) \sin \left (x\right ) - 2 \, a}{2 \, a^{2} \sin \left (x\right )} \]
[In]
[Out]
\[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=\int \frac {\csc ^{2}{\left (x \right )}}{a \cos {\left (x \right )} + b \sin {\left (x \right )}}\, dx \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 107 vs. \(2 (51) = 102\).
Time = 0.30 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.95 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {b \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a^{2}} - \frac {\sqrt {a^{2} + b^{2}} \log \left (\frac {b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{a^{2}} - \frac {\cos \left (x\right ) + 1}{2 \, a \sin \left (x\right )} - \frac {\sin \left (x\right )}{2 \, a {\left (\cos \left (x\right ) + 1\right )}} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 108 vs. \(2 (51) = 102\).
Time = 0.32 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.96 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{a^{2}} - \frac {\tan \left (\frac {1}{2} \, x\right )}{2 \, a} - \frac {\sqrt {a^{2} + b^{2}} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{a^{2}} + \frac {2 \, b \tan \left (\frac {1}{2} \, x\right ) - a}{2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )} \]
[In]
[Out]
Time = 22.96 (sec) , antiderivative size = 170, normalized size of antiderivative = 3.09 \[ \int \frac {\csc ^2(x)}{a \cos (x)+b \sin (x)} \, dx=\frac {2\,\mathrm {atanh}\left (\frac {a^3\,\cos \left (\frac {x}{2}\right )\,\sqrt {a^2+b^2}+4\,b^3\,\sin \left (\frac {x}{2}\right )\,\sqrt {a^2+b^2}+3\,a^2\,b\,\sin \left (\frac {x}{2}\right )\,\sqrt {a^2+b^2}+2\,a\,b^2\,\cos \left (\frac {x}{2}\right )\,\sqrt {a^2+b^2}}{\sin \left (\frac {x}{2}\right )\,a^4+2\,\cos \left (\frac {x}{2}\right )\,a^3\,b+5\,\sin \left (\frac {x}{2}\right )\,a^2\,b^2+2\,\cos \left (\frac {x}{2}\right )\,a\,b^3+4\,\sin \left (\frac {x}{2}\right )\,b^4}\right )\,\sqrt {a^2+b^2}}{a^2}-\frac {1}{a\,\sin \left (x\right )}-\frac {b\,\ln \left (\frac {\sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )}\right )}{a^2} \]
[In]
[Out]